<template>
  <el-dialog title="确认" :visible.sync="open" width="500px" append-to-body :close-on-click-modal="false">
    <div class="flex-center">
      <el-button @click="confirm" type="primary">确认</el-button>
    </div>
  </el-dialog>
</template>

<script>
import {mapGetters} from "vuex";

export default {
  computed: {
    ...mapGetters(['roles'])
  },
  data() {
    return {
      open: false
    }
  },
  methods: {
    show() {
      //如果是管理员的账号进入，直接过滤
      if (this.roles.includes("admin")) {
        this.$emit("confirmOk", true)
        return
      }
      this.open = true
    },
    confirm() {
      this.open = false
      this.$emit("confirmOk", true)
    }
  }
}
</script>
